app = TS.app
api = TS.api

#test data
data1 =
{
  id: 111,
  name: "问题1",
  type: "BUG",
  level: "正常",
  status: "新建",
  desc: "问题描述问题描述问题描述问题描述问题描述问题描述问题描述",
  details: "- - -",
  comment: "- - -",
  createTime: api.formatDate(),
  modifyTime: api.formatDate(),
  version: "1.0",
  publishTime: api.formatDate()
}

$('body')
.on "click", ".main-content tbody tr", ->
  if $(this).hasClass 'selected'
    app.showTask "/page/taskDetails.html", data1
  else
    $(this).siblings().removeClass 'selected'
    $(this).addClass 'selected'

$('body')
.on "click", ".control .show-item .task-key-item", ->
  key = $(this).attr "key" ? ""
  if $(this).hasClass 'selected'
    $(".main-content .table th[key=#{key}],td[key=#{key}]").hide();
    $(this).removeClass "selected"
    .blur()
  else
    $(".main-content .table th[key=#{key}],td[key=#{key}]").show();
    $(this).addClass 'selected'
    .blur()